from rest_framework import filters


class DocumentAndFormsFilter(filters.BaseFilterBackend):
    def filter_queryset(self, request, queryset, view):
        query = queryset
        params = request.query_params

        if 'type' in params:
            query = query.filter(type=params['type'])

        if 'is_checked' in params:
            query = query.filter(is_checked=params['is_checked'])

        return query
